package org.community.service.detail;


import com.alibaba.fastjson.JSONObject;
import entity.CommonResult;
import org.community.config.MultiPartConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.multipart.MultipartFile;

import java.util.Map;

@FeignClient(
        value = "community-user-detail-service",
        configuration = MultiPartConfig.class

)
@Service
public interface DetailService {

    @PostMapping(value = "/portrait/{userId}",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    Object portraitUpload(@PathVariable("userId") Integer userId, MultipartFile file);

    @PostMapping("/userInfo")
    CommonResult<String> setUserInfo(@RequestBody JSONObject userInfo);

    @GetMapping("/userInfo/{userId}/{choice}")
    CommonResult<Map<String,Object>> getUserInfoFromDB(@PathVariable("userId") Integer userId,@PathVariable("choice") Integer choice);


}
